{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "Ga2AQ1lEPaWd"
   },
   "source": [
    "The following is the python code that we used to conduct the DMR analysis and count the keywords. We ran the code using google colab with our data in the google drive. While the current version of the code demonstrates the final result as given in the paper, due to the continuous upgrades in the Tomotopy package and the use of randomness in the process of unsupervised machine learning, the training result can come out differently even with the fixed seed. However, we still believe that the outcome can pose the implications that we suggested as the words for each topics come out almost identical, and the ratio of different topics demonstrates certain level of consistency. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "CZUejWOyPezk"
   },
   "source": [
    "Mounting google drive"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "I-SLQFUrPRiV",
    "outputId": "5ad71835-8ebe-4c03-f583-63efcc556962"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n"
     ]
    }
   ],
   "source": [
    "from google.colab import drive\n",
    "drive.mount('/content/drive')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "scSgpQXCPjhs"
   },
   "source": [
    "Importing necessary packages"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "nXm3ndfpBB0y"
   },
   "outputs": [],
   "source": [
    "import nltk\n",
    "import re\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "from pprint import pprint\n",
    "# from tqdm import tqdm\n",
    "from tqdm.notebook import tqdm\n",
    "tqdm.pandas()\n",
    "import pickle\n",
    "\n",
    "\n",
    "# tomotopy\n",
    "!pip install -U tomotopy\n",
    "import tomotopy as tp\n",
    "\n",
    "# from numba import jit\n",
    "# from numba import cuda\n",
    "\n",
    "import seaborn\n",
    "import matplotlib as mpl\n",
    "import matplotlib.pyplot as plt\n",
    "import matplotlib.font_manager as fm\n",
    "# plt.rc('font', family='Malgun Gothic')\n",
    "\n",
    "# Gensim\n",
    "import gensim\n",
    "import gensim.corpora as corpora\n",
    "from gensim import corpora, models\n",
    "from gensim.utils import simple_preprocess\n",
    "from gensim.models import CoherenceModel\n",
    "from gensim.models.callbacks import PerplexityMetric\n",
    "from gensim.models.wrappers import DtmModel\n",
    "from gensim.matutils import corpus2csc\n",
    "from scipy.spatial.distance import cosine\n",
    "from scipy.stats import linregress\n",
    "from gensim.models.wrappers import LdaMallet\n",
    "##os.environ.update({'MALLET_HOME':'C:/mallet-2.0.8/mallet-2.0.8/'})\n",
    "##mallet_path = r\"C:\\Mallet\\bin\\mallet\"\n",
    "\n",
    "# spacy for lemmatization\n",
    "import spacy\n",
    "print(spacy.prefer_gpu())\n",
    "# spacy.prefer_gpu(gpu_id=1)\n",
    "\n",
    "# Plotting tools\n",
    "# import pyLDAvis\n",
    "# import pyLDAvis.gensim # don't skip this\n",
    "import matplotlib.pyplot as plt\n",
    "# %matplotlib inline\n",
    " \n",
    "# Enable logging for gensim - optional\n",
    "# import logging\n",
    "# logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.ERROR)\n",
    "# # logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)\n",
    "# logging.root.level = logging.INFO\n",
    "\n",
    "from tqdm._tqdm_notebook import tqdm_notebook\n",
    "tqdm_notebook.pandas()\n",
    "\n",
    "import warnings\n",
    "warnings.filterwarnings(\"ignore\",category=DeprecationWarning)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "38TFGxaeThHH"
   },
   "source": [
    "Retrieving data (Please edit the directory as appropriate)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "jCjkQStOCWAS"
   },
   "outputs": [],
   "source": [
    "df = pd.read_csv('/content/drive/MyDrive/sp/fpadata_without_text.csv')\n",
    "with open('/content/drive/MyDrive/sp/tokens.bin', 'rb') as pic:\n",
    "    sp = pickle.load(pic)\n",
    "df['tokens'] = pd.Series(sp)\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "4Jme9_-uM8J6"
   },
   "source": [
    "DMR analysis using sentiment score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "kFAGnwy_GrAb"
   },
   "outputs": [],
   "source": [
    "sent_dict = df[['tokens','sent_bin']].to_dict('index')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "yDtGF1dzGtao"
   },
   "outputs": [],
   "source": [
    "DMR= tp.DMRModel(k=7,min_df=0, tw=tp.TermWeight.IDF,seed=2022)#ONE, PMI, IDF "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 49,
     "referenced_widgets": [
      "84ad5b0c92d54e4fbc7a572b2fa9c7f2",
      "71ab7bfb928e4f44950b1ec01511e626",
      "f9d3eb27b5854060ac42be805fe95399",
      "1df1e9089cd341e8b097f4b00d3cc93c",
      "38ff0f76ec9140a9a9102bc54bfe6444",
      "9d7376476cd64f708dfe13b71a2cd4e5",
      "4f5615216f3945a6a4ffe537757fc581",
      "58b167741be844aa885670dbad6b6d1e",
      "ca8a20f6b24d4479acf5922cf8d98c82",
      "90fd61ce0f294251af40bbcd1363d1a2",
      "caa52714072e46fbadf28503e6c4a365"
     ]
    },
    "id": "Zdp_x-zgGvgw",
    "outputId": "00164c5d-0139-4620-c8d8-2011e7fa1f73"
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "84ad5b0c92d54e4fbc7a572b2fa9c7f2",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "  0%|          | 0/8082 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "for k in tqdm(sent_dict.keys()):\n",
    "    DMR.add_doc(sent_dict[k]['tokens'],sent_dict[k]['sent_bin'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "RNnuWkjLGxsQ",
    "outputId": "9e72f97a-86f7-4e87-80bd-57b264513539"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Num docs: 8082 , Vocab size: 57664 , Num words: 3544041\n",
      "Removed top words: []\n",
      "Training...\n",
      "Iteration: 0\tLog-likelihood: -9.427695820066782\n",
      "Iteration: 100\tLog-likelihood: -9.36168070689258\n",
      "Iteration: 200\tLog-likelihood: -9.330421270668708\n",
      "Iteration: 300\tLog-likelihood: -9.307694991231891\n",
      "Iteration: 400\tLog-likelihood: -9.293451718060497\n"
     ]
    }
   ],
   "source": [
    "# Initialize Model\n",
    "DMR.train(0)\n",
    "\n",
    "# Training the model: 100 times per iteration, 500 times in total\n",
    "print('Num docs:', len(DMR.docs), ', Vocab size:', DMR.num_vocabs, ', Num words:', DMR.num_words)\n",
    "print('Removed top words:', DMR.removed_top_words)\n",
    "print('Training...', flush=True)\n",
    "for i in range(0, 500, 100):\n",
    "    DMR.train(100)\n",
    "    print('Iteration: {}\\tLog-likelihood: {}'.format(i, DMR.ll_per_word))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "EdlDRc8BG0Dg",
    "outputId": "fdb521c1-858d-41e2-cab9-474f29833dad"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Topic #0\tcase, wuhan, virus, health, coronavirus, hospital, outbreak, infection, flight, death, confirm, patient, travel, quarantine, test, spread, lockdown, city, disease, medical\n",
      "Topic #1\taustralia, covid, student, vaccine, meat, drug, barley, morrison, sydney, food, australias, wine, victoria, federal, trial, new_zealand, labor, pandemic, queensland, pig\n",
      "Topic #2\ttrump, hong_kong, law, uk, security, taiwan, president, administration, american, us, beijing, australia, national, political, foreign, xi, united_states, policy, trade, government\n",
      "Topic #3\tcanada, india, sea, military, canadas, meng, south, consulate, border, arrest, wildlife, troop, mission, animal, soldier, journal, dispute, journalist, ottawa, charge\n",
      "Topic #4\tcompany, technology, huawei, app, datum, tech, research, use, tiktok, africa, african, build, network, user, equipment, uk, surveillance, internet, project, google\n",
      "Topic #5\txinjiang, uighur, police, child, camp, family, woman, life, old, young, school, wang, social_media, chinas, book, uighurs, online, story, post, write\n",
      "Topic #6\tmarket, economy, bank, trade, growth, tariff, investor, stock, company, price, deal, economic, business, fall, us, factory, investment, quarter, sale, production\n"
     ]
    }
   ],
   "source": [
    "# printing words for different topics\n",
    "for i in range(DMR.k):\n",
    "    res = DMR.get_topic_words(i, top_n=20)\n",
    "    print('Topic #{}'.format(i), end='\\t')\n",
    "    print(', '.join(w for w, p in res))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "JflQ9xJhG1vH",
    "outputId": "66e6cb5c-23c8-40b8-cbb9-fbcd15d2bdab"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['negative', 'positive']"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#printing the ratio of different topics based on sentiment score\n",
    "DMR.metadata_dict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "tj4mWK2SG4Sv",
    "outputId": "de7ebbfa-26a1-4b26-d7df-7d81dde2b556"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0.18461332, 0.13551694],\n",
       "       [0.09194224, 0.1924788 ],\n",
       "       [0.14744501, 0.21189825],\n",
       "       [0.3122627 , 0.13478886],\n",
       "       [0.4092961 , 0.26433757],\n",
       "       [0.21714514, 0.20610982],\n",
       "       [0.05275266, 0.06698479]], dtype=float32)"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.exp(DMR.lambdas)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "2Iu1LZn-MLB6"
   },
   "outputs": [],
   "source": [
    "sent_portion = pd.DataFrame(np.exp(DMR.lambdas))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 112
    },
    "id": "p8NTAupCCFRy",
    "outputId": "03eed5db-6a15-4b21-d977-e8cc9fe7aa99"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "  <div id=\"df-5cd0aba6-48b9-4966-a15e-8f72c3b206e3\">\n",
       "    <div class=\"colab-df-container\">\n",
       "      <div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.184613</td>\n",
       "      <td>0.091942</td>\n",
       "      <td>0.147445</td>\n",
       "      <td>0.312263</td>\n",
       "      <td>0.409296</td>\n",
       "      <td>0.217145</td>\n",
       "      <td>0.052753</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.135517</td>\n",
       "      <td>0.192479</td>\n",
       "      <td>0.211898</td>\n",
       "      <td>0.134789</td>\n",
       "      <td>0.264338</td>\n",
       "      <td>0.206110</td>\n",
       "      <td>0.066985</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>\n",
       "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-5cd0aba6-48b9-4966-a15e-8f72c3b206e3')\"\n",
       "              title=\"Convert this dataframe to an interactive table.\"\n",
       "              style=\"display:none;\">\n",
       "        \n",
       "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
       "       width=\"24px\">\n",
       "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
       "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
       "  </svg>\n",
       "      </button>\n",
       "      \n",
       "  <style>\n",
       "    .colab-df-container {\n",
       "      display:flex;\n",
       "      flex-wrap:wrap;\n",
       "      gap: 12px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert {\n",
       "      background-color: #E8F0FE;\n",
       "      border: none;\n",
       "      border-radius: 50%;\n",
       "      cursor: pointer;\n",
       "      display: none;\n",
       "      fill: #1967D2;\n",
       "      height: 32px;\n",
       "      padding: 0 0 0 0;\n",
       "      width: 32px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert:hover {\n",
       "      background-color: #E2EBFA;\n",
       "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "      fill: #174EA6;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert {\n",
       "      background-color: #3B4455;\n",
       "      fill: #D2E3FC;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert:hover {\n",
       "      background-color: #434B5C;\n",
       "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "      fill: #FFFFFF;\n",
       "    }\n",
       "  </style>\n",
       "\n",
       "      <script>\n",
       "        const buttonEl =\n",
       "          document.querySelector('#df-5cd0aba6-48b9-4966-a15e-8f72c3b206e3 button.colab-df-convert');\n",
       "        buttonEl.style.display =\n",
       "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "\n",
       "        async function convertToInteractive(key) {\n",
       "          const element = document.querySelector('#df-5cd0aba6-48b9-4966-a15e-8f72c3b206e3');\n",
       "          const dataTable =\n",
       "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
       "                                                     [key], {});\n",
       "          if (!dataTable) return;\n",
       "\n",
       "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
       "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
       "            + ' to learn more about interactive tables.';\n",
       "          element.innerHTML = '';\n",
       "          dataTable['output_type'] = 'display_data';\n",
       "          await google.colab.output.renderOutput(dataTable, element);\n",
       "          const docLink = document.createElement('div');\n",
       "          docLink.innerHTML = docLinkHtml;\n",
       "          element.appendChild(docLink);\n",
       "        }\n",
       "      </script>\n",
       "    </div>\n",
       "  </div>\n",
       "  "
      ],
      "text/plain": [
       "          0         1         2         3         4         5         6\n",
       "0  0.184613  0.091942  0.147445  0.312263  0.409296  0.217145  0.052753\n",
       "1  0.135517  0.192479  0.211898  0.134789  0.264338  0.206110  0.066985"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sent_portion.T"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "HzJd-vXeF20r"
   },
   "source": [
    "DMR analysis using month "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "p_o2JWkK6vhH"
   },
   "outputs": [],
   "source": [
    "month_dict = df[['tokens','month']].to_dict('index')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "GzcVa11XF-jB"
   },
   "outputs": [],
   "source": [
    "DMRM= tp.DMRModel(k=7,min_df=0, tw=tp.TermWeight.IDF,seed=2022)#ONE, PMI, IDF "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 49,
     "referenced_widgets": [
      "22b77f14fda44b63a8fbdeb256fbd7a0",
      "f309ae5618ba45d480c96ce0f00db534",
      "5ade9c5a776047b2b29ecfaa6a55bbd4",
      "9aa71ab5fd994f2ba3b94d8dd909077e",
      "6764f5b586aa466aa42ba536cbf5a2ab",
      "0f2c63d67f214930a59fc73c8e588c84",
      "134cbf0daae648f3a65754f3a0d57974",
      "24943215daf14a14a039e6f1ea1cd1fd",
      "ed8a4b9c137f4a97bd1a458d7b5e5066",
      "0e35c86f882849559d346314f9c09c63",
      "0b0d46c87bca44ae9cd089da21406225"
     ]
    },
    "id": "rUMaWEOqGj05",
    "outputId": "4f1b9091-09fa-4cd1-8a4d-5095ba3352b7"
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "22b77f14fda44b63a8fbdeb256fbd7a0",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "  0%|          | 0/8082 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "for k in tqdm(month_dict.keys()):\n",
    "    DMRM.add_doc(month_dict[k]['tokens'],month_dict[k]['month'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "HuWhF3uwGmgp",
    "outputId": "47dc7944-aeb5-405a-d295-c96ca8a7cc1c"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Num docs: 8082 , Vocab size: 57664 , Num words: 3544041\n",
      "Removed top words: []\n",
      "Training...\n",
      "Iteration: 0\tLog-likelihood: -9.441225766931963\n",
      "Iteration: 100\tLog-likelihood: -9.380240974796994\n",
      "Iteration: 200\tLog-likelihood: -9.34983112280867\n",
      "Iteration: 300\tLog-likelihood: -9.333903356764642\n",
      "Iteration: 400\tLog-likelihood: -9.32404433586998\n"
     ]
    }
   ],
   "source": [
    "# Initialize Model\n",
    "DMRM.train(0)\n",
    "\n",
    "# Training the model: 100 times per iteration, 500 times in total\n",
    "print('Num docs:', len(DMRM.docs), ', Vocab size:', DMRM.num_vocabs, ', Num words:', DMRM.num_words)\n",
    "print('Removed top words:', DMRM.removed_top_words)\n",
    "print('Training...', flush=True)\n",
    "for i in range(0, 500, 100):\n",
    "    DMRM.train(100)\n",
    "    print('Iteration: {}\\tLog-likelihood: {}'.format(i, DMRM.ll_per_word))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "L7ftHrjNGpmI",
    "outputId": "2ea3bf47-48ea-45ae-dc55-4b8c9f9680cd"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Topic #0\tcanada, student, app, child, canadas, meng, university, school, family, woman, young, tiktok, police, book, user\n",
      "Topic #1\tcase, flight, confirm, coronavirus, uk, covid, death, health, infection, italy, travel, lockdown, test, quarantine, passenger\n",
      "Topic #2\tcompany, market, economy, bank, growth, tariff, trade, business, stock, price, investor, export, deal, factory, economic\n",
      "Topic #3\thong_kong, law, uk, security, protest, xinjiang, uighur, freedom, journalist, foreign, legislation, human_rights, national, beijing, sanction\n",
      "Topic #4\ttrump, australia, india, taiwan, huawei, american, president, us, trade, administration, military, united_states, relationship, pandemic, deal\n",
      "Topic #5\twuhan, virus, health, outbreak, hospital, spread, disease, city, patient, epidemic, medical, human, coronavirus, sars, case\n",
      "Topic #6\tanimal, meat, wildlife, water, game, arsenal, dog, pig, player, club, eat, myanmar, south, food, river\n"
     ]
    }
   ],
   "source": [
    "# printing words for different topics\n",
    "for i in range(DMRM.k):\n",
    "    res = DMRM.get_topic_words(i, top_n=15)\n",
    "    print('Topic #{}'.format(i), end='\\t')\n",
    "    print(', '.join(w for w, p in res))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "9jJbFDS0GrsJ",
    "outputId": "528dd2b4-5bce-434b-a77d-05c939e0c43b"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['December', 'January', 'February', 'March', 'April', 'May', 'June', 'July']"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#printing the ratio of different topics based on month\n",
    "DMRM.metadata_dict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "n4nSbkxjGtLY",
    "outputId": "e4300ffe-4a69-42f1-cd4e-8ffa627d48d7"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0.22300252, 0.10573918, 0.13623217, 0.18844008, 0.16663153,\n",
       "        0.1683682 , 0.36118093, 0.20997219],\n",
       "       [0.03665708, 0.16261971, 0.24410938, 0.31338498, 0.18456088,\n",
       "        0.08019801, 0.07986103, 0.05489585],\n",
       "       [0.26159245, 0.17218003, 0.14149192, 0.26423338, 0.170967  ,\n",
       "        0.19186069, 0.1917274 , 0.20874456],\n",
       "       [0.30958942, 0.11995674, 0.1804612 , 0.11389737, 0.3866782 ,\n",
       "        0.38888845, 0.4988101 , 0.52385646],\n",
       "       [0.37678128, 0.18753594, 0.21227562, 0.2149139 , 0.4816112 ,\n",
       "        0.49538887, 0.73338443, 0.60190135],\n",
       "       [0.11806456, 0.21336402, 0.4360209 , 0.47731403, 0.55014646,\n",
       "        0.19308816, 0.11935998, 0.08232785],\n",
       "       [0.10683237, 0.05399783, 0.08081767, 0.08210019, 0.06942961,\n",
       "        0.04946121, 0.06735382, 0.08344897]], dtype=float32)"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.exp(DMRM.lambdas)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 300
    },
    "id": "jYKxWD-1K-EN",
    "outputId": "67c78313-ba93-4733-91d3-0d1dc3438b81"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "  <div id=\"df-2ba90788-341a-498e-99ca-4561ba8a914b\">\n",
       "    <div class=\"colab-df-container\">\n",
       "      <div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.223003</td>\n",
       "      <td>0.036657</td>\n",
       "      <td>0.261592</td>\n",
       "      <td>0.309589</td>\n",
       "      <td>0.376781</td>\n",
       "      <td>0.118065</td>\n",
       "      <td>0.106832</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.105739</td>\n",
       "      <td>0.162620</td>\n",
       "      <td>0.172180</td>\n",
       "      <td>0.119957</td>\n",
       "      <td>0.187536</td>\n",
       "      <td>0.213364</td>\n",
       "      <td>0.053998</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.136232</td>\n",
       "      <td>0.244109</td>\n",
       "      <td>0.141492</td>\n",
       "      <td>0.180461</td>\n",
       "      <td>0.212276</td>\n",
       "      <td>0.436021</td>\n",
       "      <td>0.080818</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.188440</td>\n",
       "      <td>0.313385</td>\n",
       "      <td>0.264233</td>\n",
       "      <td>0.113897</td>\n",
       "      <td>0.214914</td>\n",
       "      <td>0.477314</td>\n",
       "      <td>0.082100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.166632</td>\n",
       "      <td>0.184561</td>\n",
       "      <td>0.170967</td>\n",
       "      <td>0.386678</td>\n",
       "      <td>0.481611</td>\n",
       "      <td>0.550146</td>\n",
       "      <td>0.069430</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0.168368</td>\n",
       "      <td>0.080198</td>\n",
       "      <td>0.191861</td>\n",
       "      <td>0.388888</td>\n",
       "      <td>0.495389</td>\n",
       "      <td>0.193088</td>\n",
       "      <td>0.049461</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0.361181</td>\n",
       "      <td>0.079861</td>\n",
       "      <td>0.191727</td>\n",
       "      <td>0.498810</td>\n",
       "      <td>0.733384</td>\n",
       "      <td>0.119360</td>\n",
       "      <td>0.067354</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0.209972</td>\n",
       "      <td>0.054896</td>\n",
       "      <td>0.208745</td>\n",
       "      <td>0.523856</td>\n",
       "      <td>0.601901</td>\n",
       "      <td>0.082328</td>\n",
       "      <td>0.083449</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>\n",
       "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-2ba90788-341a-498e-99ca-4561ba8a914b')\"\n",
       "              title=\"Convert this dataframe to an interactive table.\"\n",
       "              style=\"display:none;\">\n",
       "        \n",
       "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
       "       width=\"24px\">\n",
       "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
       "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
       "  </svg>\n",
       "      </button>\n",
       "      \n",
       "  <style>\n",
       "    .colab-df-container {\n",
       "      display:flex;\n",
       "      flex-wrap:wrap;\n",
       "      gap: 12px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert {\n",
       "      background-color: #E8F0FE;\n",
       "      border: none;\n",
       "      border-radius: 50%;\n",
       "      cursor: pointer;\n",
       "      display: none;\n",
       "      fill: #1967D2;\n",
       "      height: 32px;\n",
       "      padding: 0 0 0 0;\n",
       "      width: 32px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert:hover {\n",
       "      background-color: #E2EBFA;\n",
       "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "      fill: #174EA6;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert {\n",
       "      background-color: #3B4455;\n",
       "      fill: #D2E3FC;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert:hover {\n",
       "      background-color: #434B5C;\n",
       "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "      fill: #FFFFFF;\n",
       "    }\n",
       "  </style>\n",
       "\n",
       "      <script>\n",
       "        const buttonEl =\n",
       "          document.querySelector('#df-2ba90788-341a-498e-99ca-4561ba8a914b button.colab-df-convert');\n",
       "        buttonEl.style.display =\n",
       "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "\n",
       "        async function convertToInteractive(key) {\n",
       "          const element = document.querySelector('#df-2ba90788-341a-498e-99ca-4561ba8a914b');\n",
       "          const dataTable =\n",
       "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
       "                                                     [key], {});\n",
       "          if (!dataTable) return;\n",
       "\n",
       "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
       "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
       "            + ' to learn more about interactive tables.';\n",
       "          element.innerHTML = '';\n",
       "          dataTable['output_type'] = 'display_data';\n",
       "          await google.colab.output.renderOutput(dataTable, element);\n",
       "          const docLink = document.createElement('div');\n",
       "          docLink.innerHTML = docLinkHtml;\n",
       "          element.appendChild(docLink);\n",
       "        }\n",
       "      </script>\n",
       "    </div>\n",
       "  </div>\n",
       "  "
      ],
      "text/plain": [
       "          0         1         2         3         4         5         6\n",
       "0  0.223003  0.036657  0.261592  0.309589  0.376781  0.118065  0.106832\n",
       "1  0.105739  0.162620  0.172180  0.119957  0.187536  0.213364  0.053998\n",
       "2  0.136232  0.244109  0.141492  0.180461  0.212276  0.436021  0.080818\n",
       "3  0.188440  0.313385  0.264233  0.113897  0.214914  0.477314  0.082100\n",
       "4  0.166632  0.184561  0.170967  0.386678  0.481611  0.550146  0.069430\n",
       "5  0.168368  0.080198  0.191861  0.388888  0.495389  0.193088  0.049461\n",
       "6  0.361181  0.079861  0.191727  0.498810  0.733384  0.119360  0.067354\n",
       "7  0.209972  0.054896  0.208745  0.523856  0.601901  0.082328  0.083449"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.DataFrame(np.exp(DMRM.lambdas)).T"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "ZamgcM0iTLFu"
   },
   "source": [
    "Counting keywords"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "PZX_TAlcTKTd"
   },
   "outputs": [],
   "source": [
    "word_list = ['wechat','weibo','baidu']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "ZYvLzTGsttI5"
   },
   "outputs": [],
   "source": [
    "def count_words(text, word_list):\n",
    "    word_count_dic = {}\n",
    "    for i in word_list:\n",
    "        word_count_dic[i] = 0\n",
    "    for word in text:\n",
    "        if word in word_list:\n",
    "            if word in word_count_dic.keys():\n",
    "                count = word_count_dic[word] + 1\n",
    "                word_count_dic[word] = count\n",
    "    return word_count_dic\n",
    "\n",
    "def into_columns_word(data, col):\n",
    "    return data[col]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "dR6kD1TDTRdi"
   },
   "outputs": [],
   "source": [
    "df[\"count\"] = df.progress_apply(lambda x : count_words(x[\"tokens\"], word_list), axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "HevPvVBPTTiZ"
   },
   "outputs": [],
   "source": [
    "for col in tqdm_notebook(word_list):\n",
    "    df[col] = df.apply(lambda x : into_columns_word(x[\"count\"],col), axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "fL4aH8-vTXIt"
   },
   "outputs": [],
   "source": [
    "keyword1 = df.groupby(['month']).sum()\n",
    "keyword1[['wechat','weibo','baidu']]"
   ]
  }
 ],
 "metadata": {
  "accelerator": "GPU",
  "colab": {
   "collapsed_sections": [],
   "provenance": []
  },
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "0b0d46c87bca44ae9cd089da21406225": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "0e35c86f882849559d346314f9c09c63": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "0f2c63d67f214930a59fc73c8e588c84": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "134cbf0daae648f3a65754f3a0d57974": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "1df1e9089cd341e8b097f4b00d3cc93c": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_90fd61ce0f294251af40bbcd1363d1a2",
      "placeholder": "​",
      "style": "IPY_MODEL_caa52714072e46fbadf28503e6c4a365",
      "value": " 8082/8082 [00:00&lt;00:00, 7746.38it/s]"
     }
    },
    "22b77f14fda44b63a8fbdeb256fbd7a0": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HBoxModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HBoxModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HBoxView",
      "box_style": "",
      "children": [
       "IPY_MODEL_f309ae5618ba45d480c96ce0f00db534",
       "IPY_MODEL_5ade9c5a776047b2b29ecfaa6a55bbd4",
       "IPY_MODEL_9aa71ab5fd994f2ba3b94d8dd909077e"
      ],
      "layout": "IPY_MODEL_6764f5b586aa466aa42ba536cbf5a2ab"
     }
    },
    "24943215daf14a14a039e6f1ea1cd1fd": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "38ff0f76ec9140a9a9102bc54bfe6444": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "4f5615216f3945a6a4ffe537757fc581": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "58b167741be844aa885670dbad6b6d1e": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "5ade9c5a776047b2b29ecfaa6a55bbd4": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "FloatProgressModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "FloatProgressModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "ProgressView",
      "bar_style": "success",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_24943215daf14a14a039e6f1ea1cd1fd",
      "max": 8082,
      "min": 0,
      "orientation": "horizontal",
      "style": "IPY_MODEL_ed8a4b9c137f4a97bd1a458d7b5e5066",
      "value": 8082
     }
    },
    "6764f5b586aa466aa42ba536cbf5a2ab": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "71ab7bfb928e4f44950b1ec01511e626": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_9d7376476cd64f708dfe13b71a2cd4e5",
      "placeholder": "​",
      "style": "IPY_MODEL_4f5615216f3945a6a4ffe537757fc581",
      "value": "100%"
     }
    },
    "84ad5b0c92d54e4fbc7a572b2fa9c7f2": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HBoxModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HBoxModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HBoxView",
      "box_style": "",
      "children": [
       "IPY_MODEL_71ab7bfb928e4f44950b1ec01511e626",
       "IPY_MODEL_f9d3eb27b5854060ac42be805fe95399",
       "IPY_MODEL_1df1e9089cd341e8b097f4b00d3cc93c"
      ],
      "layout": "IPY_MODEL_38ff0f76ec9140a9a9102bc54bfe6444"
     }
    },
    "90fd61ce0f294251af40bbcd1363d1a2": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "9aa71ab5fd994f2ba3b94d8dd909077e": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_0e35c86f882849559d346314f9c09c63",
      "placeholder": "​",
      "style": "IPY_MODEL_0b0d46c87bca44ae9cd089da21406225",
      "value": " 8082/8082 [00:01&lt;00:00, 8273.79it/s]"
     }
    },
    "9d7376476cd64f708dfe13b71a2cd4e5": {
     "model_module": "@jupyter-widgets/base",
     "model_module_version": "1.2.0",
     "model_name": "LayoutModel",
     "state": {
      "_model_module": "@jupyter-widgets/base",
      "_model_module_version": "1.2.0",
      "_model_name": "LayoutModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "LayoutView",
      "align_content": null,
      "align_items": null,
      "align_self": null,
      "border": null,
      "bottom": null,
      "display": null,
      "flex": null,
      "flex_flow": null,
      "grid_area": null,
      "grid_auto_columns": null,
      "grid_auto_flow": null,
      "grid_auto_rows": null,
      "grid_column": null,
      "grid_gap": null,
      "grid_row": null,
      "grid_template_areas": null,
      "grid_template_columns": null,
      "grid_template_rows": null,
      "height": null,
      "justify_content": null,
      "justify_items": null,
      "left": null,
      "margin": null,
      "max_height": null,
      "max_width": null,
      "min_height": null,
      "min_width": null,
      "object_fit": null,
      "object_position": null,
      "order": null,
      "overflow": null,
      "overflow_x": null,
      "overflow_y": null,
      "padding": null,
      "right": null,
      "top": null,
      "visibility": null,
      "width": null
     }
    },
    "ca8a20f6b24d4479acf5922cf8d98c82": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "ProgressStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "ProgressStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "bar_color": null,
      "description_width": ""
     }
    },
    "caa52714072e46fbadf28503e6c4a365": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "DescriptionStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "DescriptionStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "description_width": ""
     }
    },
    "ed8a4b9c137f4a97bd1a458d7b5e5066": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "ProgressStyleModel",
     "state": {
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "ProgressStyleModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/base",
      "_view_module_version": "1.2.0",
      "_view_name": "StyleView",
      "bar_color": null,
      "description_width": ""
     }
    },
    "f309ae5618ba45d480c96ce0f00db534": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "HTMLModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "HTMLModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "HTMLView",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_0f2c63d67f214930a59fc73c8e588c84",
      "placeholder": "​",
      "style": "IPY_MODEL_134cbf0daae648f3a65754f3a0d57974",
      "value": "100%"
     }
    },
    "f9d3eb27b5854060ac42be805fe95399": {
     "model_module": "@jupyter-widgets/controls",
     "model_module_version": "1.5.0",
     "model_name": "FloatProgressModel",
     "state": {
      "_dom_classes": [],
      "_model_module": "@jupyter-widgets/controls",
      "_model_module_version": "1.5.0",
      "_model_name": "FloatProgressModel",
      "_view_count": null,
      "_view_module": "@jupyter-widgets/controls",
      "_view_module_version": "1.5.0",
      "_view_name": "ProgressView",
      "bar_style": "success",
      "description": "",
      "description_tooltip": null,
      "layout": "IPY_MODEL_58b167741be844aa885670dbad6b6d1e",
      "max": 8082,
      "min": 0,
      "orientation": "horizontal",
      "style": "IPY_MODEL_ca8a20f6b24d4479acf5922cf8d98c82",
      "value": 8082
     }
    }
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
